import java.util.*;

class Student {
    String xuehao;
    String name;
    int chengji;

    @Override
    public String toString() {
        return "学号" + xuehao + "\n"
                + "姓名" + name + "\n"
                + "成绩" + chengji;
    }
}

public class Day3_15trial {
    public static void main(String[] args) {
        int select = 1;
        ArrayList<Student> students = new ArrayList<Student>();
        Scanner sc = new Scanner(System.in);
        System.out.println();
        System.out.println("------------------------------------------");
        System.out.println("*                         *");
        System.out.println("*欢迎进入学生成绩管理系统*");
        System.out.println("*                         *");
        System.out.println("------------------------------------------");
        while (true) {
            System.out.println();
            System.out.println("请选择你的操作：");
            System.out.println("             1，录入学生成绩；");
            System.out.println("             2，显示学生信息；");
            System.out.println("             0，退出");
            System.out.println("             请输入数子选项（0-2）");
            select = sc.nextInt();
            System.out.println();
            // 判断输入，0退出
            if (select >= 0 && select <= 2) {
                Student temp = new Student();
                switch (select) {
                    case 1:
                        System.out.println("请输入学号：");
                        temp.xuehao = sc.next();
                        System.out.println();
                        System.out.println("请输入学生姓名：");
                        temp.name = sc.next();
                        System.out.println();
                        System.out.println("请输入成绩：");
                        temp.chengji = sc.nextInt();
                        System.out.println();
                        students.add(temp);
                        break;

                    case 2:
                        System.out.println("所有学生成绩如下：");
                        System.out.println("您选择了显示所有学生信息");
                        for (Object element : students) {
                            System.out.println(element.toString());
                        }

                        break;

                    case 0:
                        System.exit(0);
                }
            } else {
                System.out.println("输入错误信息，请重新输入");
                continue;
            }
        }
    }
}
